﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        System.Console.WriteLine("Hello World!");
        
        //防止上当小常识
        DataSet ds = new DataSet();
        DataTable dt = DT.createTable();
        result rs = new result();
        DataRow dr;
        rs.fillUp(ds);
        if (ds.Tables[0].Rows.Count > 0)
        {
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                dr = dt.NewRow();
                dr[0] = "img/topic_open.gif";
                dr[1] = ds.Tables[0].Rows[i]["title"].ToString();
                dr[2] = ds.Tables[0].Rows[i]["insertuser"].ToString();
                dr[3] = "0";
                dr[4] = "0";
                dr[5] = ds.Tables[0].Rows[i]["inserttime"].ToString().Split(' ')[0].ToString();
                dr[6] = "page.aspx?id=" + ds.Tables[0].Rows[i]["id"].ToString();
                dt.Rows.Add(dr);
            }
            GridView1.DataSource = dt;
            GridView1.DataBind();
        }
        //骗人那点事情
        DataSet dspz = new DataSet();
        DataSet dspzm = new DataSet();
        DataTable dtpz = DT.createTable();
        DataRow drpz;
        rs.fillDown(dspz, "2");
        if (dspz.Tables[0].Rows.Count > 0)
        {
            for (int i = 0; i < dspz.Tables[0].Rows.Count; i++)
            {
                dspzm.Clear();
                dspzm.AcceptChanges();
                drpz = dtpz.NewRow();
                drpz[0] = "img/topic_open.gif";
                drpz[1] = dspz.Tables[0].Rows[i]["title"].ToString();
                drpz[2] = dspz.Tables[0].Rows[i]["insertuser"].ToString();
                drpz[3] = "0";
                rs.fillMsg(dspzm, dspz.Tables[0].Rows[i]["id"].ToString());
                if (dspzm.Tables[0].Rows.Count > 0)
                {
                    drpz[4] = dspzm.Tables[0].Rows.Count.ToString();
                }
                else
                {
                    drpz[4] = "0";
                }
                if (dspz.Tables[0].Rows[i]["mtime"].ToString() == string.Empty)
                {
                    drpz[5] = dspz.Tables[0].Rows[i]["inserttime"].ToString().Split(' ')[0].ToString();
                }
                else
                {
                    drpz[5] = dspz.Tables[0].Rows[i]["mtime"].ToString().Split(' ')[0].ToString();
                }
                drpz[6] = "page.aspx?id=" + dspz.Tables[0].Rows[i]["id"].ToString();
                dtpz.Rows.Add(drpz);
            }
            GridView2.DataSource = dtpz;
            GridView2.DataBind();
        }
        //骗人网站
        //DataSet dssite = new DataSet();
        //DataSet dssitem = new DataSet();
        //DataTable dtsite = DT.createTable();
        //DataRow drsite;
        //rs.fillDown(dssite, "3");
        //if (dssite.Tables[0].Rows.Count > 0)
        //{
        //    for (int i = 0; i < dssite.Tables[0].Rows.Count; i++)
        //    {
        //        dssitem.Clear();
        //        dssitem.AcceptChanges();
        //        drsite = dtsite.NewRow();
        //        drsite[0] = "img/topic_open.gif";
        //        drsite[1] = dssite.Tables[0].Rows[i]["title"].ToString();
        //        drsite[2] = dssite.Tables[0].Rows[i]["insertuser"].ToString();
        //        drsite[3] = "0";
        //        rs.fillMsg(dssitem, dssite.Tables[0].Rows[i]["id"].ToString());
        //        if (dssitem.Tables[0].Rows.Count > 0)
        //        {
        //            drsite[4] = dssitem.Tables[0].Rows.Count.ToString();
        //        }
        //        else
        //        {
        //            drsite[4] = "0";
        //        }
        //        if (dssite.Tables[0].Rows[i]["mtime"].ToString() == string.Empty)
        //        {
        //            drsite[5] = dssite.Tables[0].Rows[i]["inserttime"].ToString().Split(' ')[0].ToString();
        //        }
        //        else
        //        {
        //            drsite[5] = dssite.Tables[0].Rows[i]["mtime"].ToString().Split(' ')[0].ToString();
        //        }
        //        drsite[6] = "page.aspx?id=" + dssite.Tables[0].Rows[i]["id"].ToString();
        //        dtsite.Rows.Add(drsite);
        //    }
        //    GridView3.DataSource = dtsite;
        //    GridView3.DataBind();
        //}
        //骗人短信
        //DataSet dsdx = new DataSet();
        //DataSet dsdxm = new DataSet();
        //DataTable dtdx = DT.createTable();
        //DataRow drdx;
        //rs.fillDown(dsdx, "4");
        //if (dsdx.Tables[0].Rows.Count > 0)
        //{
        //    for (int i = 0; i < dsdx.Tables[0].Rows.Count; i++)
        //    {
        //        dsdxm.Clear();
        //        dsdxm.AcceptChanges();
        //        drdx = dtdx.NewRow();
        //        drdx[0] = "img/topic_open.gif";
        //        drdx[1] = dsdx.Tables[0].Rows[i]["title"].ToString();
        //        drdx[2] = dsdx.Tables[0].Rows[i]["insertuser"].ToString();
        //        drdx[3] = "0";
        //        rs.fillMsg(dsdxm, dsdx.Tables[0].Rows[i]["id"].ToString());
        //        if (dsdxm.Tables[0].Rows.Count > 0)
        //        {
        //            drdx[4] = dsdxm.Tables[0].Rows.Count.ToString();
        //        }
        //        else
        //        {
        //            drdx[4] = "0";
        //        }
        //        if (dsdx.Tables[0].Rows[i]["mtime"].ToString() == string.Empty)
        //        {
        //            drdx[5] = dsdx.Tables[0].Rows[i]["inserttime"].ToString().Split(' ')[0].ToString();
        //        }
        //        else
        //        {
        //            drdx[5] = dsdx.Tables[0].Rows[i]["mtime"].ToString().Split(' ')[0].ToString();
        //        }
        //        drdx[6] = "page.aspx?id=" + dsdx.Tables[0].Rows[i]["id"].ToString();
        //        dtdx.Rows.Add(drdx);
        //    }
        //    GridView4.DataSource = dtdx;
        //    GridView4.DataBind();
        //}
    }
}
